﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Vit.Mvc.Extensions
{
    public static class StringExtensions
    {
        public static void ResolveRoutes(this string url, out string area, out string controller, out string action)
        {
            area = controller = action = string.Empty;
            string[] parts = url.Split(new char[] { '/' }, StringSplitOptions.RemoveEmptyEntries);
            if (parts.Length == 2)
            {
                controller = parts[0];
                action = parts[1];
            }
            else if (parts.Length == 3)
            {
                area = parts[0];
                controller = parts[1];
                action = parts[2];
            }
        }
    }
}
